import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '@/views/login'
import Layout from '@/views/layout'
import Home from '@/views/layout/home.vue'
import News from '@/views/layout/news.vue'
import Wish from '@/views/layout/wish.vue'
import My from '@/views/layout/my.vue'
import Staff from '@/views/staff/staff.vue'
import NotFound from '@/views/NotFound/NotFound.vue' // 导入 404 页面组件

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [
    {
      path: '/',
      component: Login
    },
    {
      path: '/layout',
      redirect: '/home',
      component: Layout,
      children: [
        { path: '/home', component: Home },
        { path: '/staff', component: Staff },
        { path: '/news', component: News },
        { path: '/wish', component: Wish },
        { path: '/my', component: My }
      ]
    },
    {
      path: '*', // 匹配任何未定义的路由
      component: NotFound // 渲染 404 页面组件
    }
  ]
})

export default router
